<%@ page contentType="text/html; charset=UTF-8" language="java"
	import="base.tools.Constants,java.util.*" errorPage=""%>
<%@ include file="../../common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>权限授予</title>
	<script src="<%=Constants.PREFIX_PATH %>/js/jquery.js" type="text/javascript"></script>
	<script src="<%=Constants.PREFIX_PATH %>/js/pony.js" type="text/javascript"></script>
	<link href="<%=Constants.PREFIX_PATH%>/css/admin.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript">
		function getTableForm() {
			return document.getElementById('tableForm');
		}
		function optUpdata() {
			if(Pn.checkedCount('ids')<=0) {
				alert("至少选择一种权限");
				return;
			}
			var f = getTableForm();
			f.action="<%=Constants.PREFIX_PATH%>/UsersAction.do?opt=user_edit";
			f.submit();
		}
			$(function() {
			$(".perm-container input[type=checkbox]").each(function() {
				var perm = $(this).val();
				var index = perm.indexOf(",");		
				if(index!=-1) {
					perm = perm.substring(0,index);
				}
				for(var i=0,len=perms.length;i<len;i++) {
					if(perms[i]==perm) {
						$(this).attr("checked",true);
						break;
					}
				}
			});
		});
	</script>
	</head>
	<body bgcolor="#FFFFFF">
		<div class="body-box">
			<div class="rhead">
				<div class="rpos">
					当前位置: 角色管理 - 修改
				</div>
				<form class="ropt">
					<input type="button" value="返回列表" onclick="location='<%=Constants.PREFIX_PATH %>/UsersAction.do?opt=usersList';" />
				</form>
				<div class="clear"></div>
			</div></div>
			<form method="post" action="<%=Constants.PREFIX_PATH %>/UsersAction.do" id="tableForm">
				<input type="hidden" name="opt" value="user_edit" />
				<table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">
					<tr>
						<td  class="td_title_right_oth" width="15%" class="pn-flabel pn-flabel-h">
							<span class="pn-frequired">*</span>角色名:
						</td>
						<td class="td_title_right_oth"  colspan="3" width="35%" class="pn-fcontent">
						<bean:write name='role' property='USERNAME'/>
						</td>
					</tr>
					<tr>
						<td width="15%">
							功能权限:（ <input type='checkbox' onclick='Pn.checkbox("ids",this.checked)'/> 全选）
						</td>
						<td class="td_title_right_oth"  colspan="3" width="85%">
						<input type="hidden" name="role_id"	value="<bean:write name='role' property='ROLE_ID'/>" />
						<logic:iterate id="list" name="infoList">
						<input type='checkbox' name='ids' <logic:equal name="list" property="IF_SHOW" value="true">checked="checked"</logic:equal> value='<bean:write name="list" property="TOP_MENU_ID_USERS"/>'/>
						<bean:write name='list' property='TOP_MENU_NAME'/>
						</logic:iterate>
						</td>
					</tr>
					<tr>
						<td class="td_title_right_oth"  colspan="4" class="pn-fbutton">
							<input type="button" value="提交" onclick="optUpdata();" />
							&nbsp;
							<input type="reset" value="重置" />
						</td>
					</tr>
				</table>
			</form>
	</body>
</html>